﻿using IdentityData.Entities;
using Microsoft.AspNetCore.Identity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Service
{
   public  class SigninService
    {
        private readonly SignInManager<ApplicationUser> _signInManager;
        public SigninService(SignInManager<ApplicationUser> signInManager)
        {
            _signInManager = signInManager;
        }

       /// <summary>
       /// 登录
       /// </summary>
       /// <param name="user"></param>
       /// <param name="password"></param>
       /// <param name="lockoutOnFailure"></param>
       /// <returns></returns>
        public async Task SigninAsync(ApplicationUser user,string password, bool lockoutOnFailure)
        {
            await _signInManager.CheckPasswordSignInAsync(user, password,lockoutOnFailure);
        }

        /// <summary>
        /// 登出
        /// </summary>
        /// <returns></returns>
        public async Task SignOutAsync()
        {
            await _signInManager.SignOutAsync();
        }


    }
}
